package com.atguigu.crowd.mvc.handler;


import com.atguigu.crowd.mapper.HardWareProtocolMapper;
import com.atguigu.crowd.mapper.bean.HardWareProtocol;
import com.atguigu.crowd.service.api.HardWareProtocolService;
import com.atguigu.crowd.service.impl.HardWareProtocolImpl;
import com.atguigu.crowd.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class HardWareProtocolHandler {

    @Autowired
    HardWareProtocolService hardWareProtocolService;

    @Autowired
    private static HardWareProtocolMapper hardWareProtocolMapper;

    public static void main(String[] args) {
        HardWareProtocol hardWareProtocol = hardWareProtocolMapper.selectByPrimaryKey(1);
        System.out.println(hardWareProtocol);
    }



    @RequestMapping("get/hard/ware/protocol")
    public ResultEntity<List<HardWareProtocol>> fordWardHardWareProtocol () {
        try {
            List<HardWareProtocol> hardWareProtocol = hardWareProtocolService.getHardWareProtocol();
            return ResultEntity.successWithData(hardWareProtocol);
        }catch (Exception e) {
            e.printStackTrace();
            return ResultEntity.failed(e.getMessage());
        }
    }


}
